sc.config
Lets you read configurations of the current world
Structures
Configuration
A configuration for ScrapComputers.
Fields:
- id [ string ] The id of the config. Reccommended to be in this format to not cause any conflicts:
[MOD_NAME].[COMPONENT_NAME].[CONFIG_NAME]
- name [ string ] The name of the config
- description [ string ] The description of the config
- selectedOption [ integer ] The current config's selected option
- hostOnly [ boolean ] If the configuration is host only accessable
- options [ string[] ] List of usable options for the config.
Functions
nameToId
sc.config.nameToId( name )
Converts a name to a id
Arguments:
- name [ string ] The name of the config
Returns:
- [ string? ] The id of the config
getConfigByIndex
sc.config.getConfigByIndex( index )
Gets a configuration by index (not id!) Will error if not found.
Arguments:
- index [ integer ] The index to search
Returns:
- [ Configuration ] The configuration it has found.
getTotalConfigurations
sc.config.getTotalConfigurations()
Gets the total configurations and returns it
Returns:
- [ integer ] The amount of configurations
getConfig
sc.config.getConfig( id )
Gets a configuration by id Will error if not found.
Arguments:
- id [ string ] The ID of the config
Returns:
- [ Configuration ] The configuration it has found.
configExists
sc.config.configExists( id )
Returns true if a configuration existed via ID
Arguments:
- id [ string ] The ID of the configuration
Returns:
- [ boolean ] If the configuration existed or not